![]()
![]()
![]()
Dynamic Windows =============== Let's say an application object is already set up and another (not yet existing) window has to be added. First, the window object needs to be created: win = WindowObject, MUIA_Window_Title, "New Window", WindowContents, VGroup, Child, ..., Child, ..., Child, ..., End, End, End; if (!win) fail(); /* failure check */ After the window object is created, it can be added to the application as one of its children: DoMethod(app,OM_ADDMEMBER,win); Now this window has become a part of the application, just as if it had been created as a subwindow together with the application object. It can be opened and closed by setting the according attributes and will be deleted automatically as soon as the application is ended. Usually, however, you'll want to delete this window directly after usage, because the late binding wouldn't make much sense otherwise. After closing the window via set(win,MUIA_Window_Open,FALSE); you can remove it by calling DoMethod(app,OM_REMMEMBER,win); After this you have to delete the window object "by hand", since the application no longer knows of it: MUI_DisposeObject(win); This method makes it possible to create subroutines that open their own window, wait for some imput events und return something. To illustrate this, here is a short example: set(app,MUIA_Application_Sleep,TRUE); // disable other windows win = WindowObject, ...., End; // create new window if (win) // ok ? { DoMethod(app,OM_ADDMEMBER,win); // add window... set(win,MUIA_Window_Open,TRUE); // and open it while (running) { switch (DoMethod(app,MUIM_Application_Input,&sigs)) { ... // Extra Input loop. For this window only. ... // Note: The special value ... // MUIV_Application_ReturnID_Quit should be recognized ... // as well } } set(win,MUIA_Window_Open,FALSE); // Close window DoMethod(app,OM_REMMEMBER,win); // remove MUI_DisposeObject(win); // and kill it } set(app,MUIA_Application_Sleep,FALSE); // wake up the application